package com.zxw.设计模式.结构型.组合模式;

/**
 * @projectName: util-cloud
 * @package: com.zxw.设计模式.结构型.组合模式
 * @className: File
 * @author: zhangxuewei
 * @description: TODO
 * @date: 2023/9/28 10:05
 * @version: 1.0
 */
public class File extends Entry {
    private String name;
    private int size;

    public File(String name, int size) {
        this.name = name;
        this.size = size;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public int getSize() {
        return this.size;
    }


    /**
     * 叶子节点是不允许添加文件的
     *
     * @param entry
     * @return
     */
    @Override
    public Entry add(Entry entry) {
        return null;
    }


    @Override
    public void printList(String prefix) {
        System.out.println(prefix + "/" + this);
    }
}